CREATE TABLE
IF
	NOT EXISTS banks ( cardId BIGINT PRIMARY KEY COMMENT '卡号', 
	balance DECIMAL ( 10, 2 ) NOT NULL COMMENT '账号余额' )
	
#查看mysql是否自动提交事务
show VARIABLES like '%autocommit%';

INSERT INTO banks(`cardId`,`balance`) VALUES (1,5000.00);
INSERT INTO banks(`cardId`,`balance`) VALUES (2,8000.00);

#关闭mysql自动提交事务
set autocommit = off;

begin;
UPDATE banks set balance=balance-500 where `cardId`=1;
UPDATE banks set balance=balance+500 where `cardId`=2;

COMMIT;
set autocommit=on;